<?php

class ConsultaTramitesForm extends sfFormSymfony
{
  public function setup()
  {
    $tiposDoc = Doctrine_Core::getTable('TipoDoc')->findAll()->getData();
    $this->setWidgets(array(
      'tipo_doc'  => new sfWidgetFormChoice(array(
                          'choices' => array_combine($tiposDoc, $tiposDoc),
                          'label' => 'Tipo Documento'
                     )),
      'numero'    => new sfWidgetFormInputText(array(
                          'label' => 'Número'
                     )),
    ));
    $this->setValidators(array(
      'tipo_doc'  => new sfValidatorChoice(array(
                          'choices' => $tiposDoc,
                          'required' => true
                     )),
      'numero'    => new sfValidatorString(array(
                          'max_length' => 15,
                          'required' => true
                     ))
    ));
    $this->widgetSchema->setNameFormat('consulta_tramite[%s]');
  }

}
